package com.ly.heart.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ly.common.utils.DateUtils;
import com.ly.heart.service.IOrderSupplierService;
import org.springframework.stereotype.Service;
import com.ly.heart.mapper.OrderSupplierMapper;
import com.ly.heart.domain.OrderSupplierEntity;

import javax.annotation.Resource;

/**
 * 采购订单与供应商关联Service业务层处理
 *
 * @author cxl
 * @date 2024-06-06
 */
@Service
public class OrderSupplierServiceImpl extends ServiceImpl<OrderSupplierMapper,OrderSupplierEntity> implements IOrderSupplierService {

    @Resource
    private OrderSupplierMapper orderSupplierMapper;

    /**
     * 查询采购订单与供应商关联
     *
     * @param id 采购订单与供应商关联ID
     * @return 采购订单与供应商关联
     */
    @Override
    public OrderSupplierEntity selectOrderSupplierEntityById(String id)
    {
        return orderSupplierMapper.selectOrderSupplierEntityById(id);
    }

    /**
     * 查询采购订单与供应商关联列表
     *
     * @param orderSupplierEntity 采购订单与供应商关联
     * @return 采购订单与供应商关联
     */
    @Override
    public List<OrderSupplierEntity> selectOrderSupplierEntityList(OrderSupplierEntity orderSupplierEntity)
    {
        return orderSupplierMapper.selectOrderSupplierEntityList(orderSupplierEntity);
    }

    /**
     * 新增采购订单与供应商关联
     *
     * @param orderSupplierEntity 采购订单与供应商关联
     * @return 结果
     */
    @Override
    public int insertOrderSupplierEntity(OrderSupplierEntity orderSupplierEntity)
    {
        orderSupplierEntity.setCreateTime(DateUtils.getNowDate());
        return orderSupplierMapper.insertOrderSupplierEntity(orderSupplierEntity);
    }

    /**
     * 修改采购订单与供应商关联
     *
     * @param orderSupplierEntity 采购订单与供应商关联
     * @return 结果
     */
    @Override
    public int updateOrderSupplierEntity(OrderSupplierEntity orderSupplierEntity)
    {
        return orderSupplierMapper.updateOrderSupplierEntity(orderSupplierEntity);
    }

    /**
     * 批量删除采购订单与供应商关联
     *
     * @param ids 需要删除的采购订单与供应商关联ID
     * @return 结果
     */
    @Override
    public int deleteOrderSupplierEntityByIds(String[] ids)
    {
        return orderSupplierMapper.deleteOrderSupplierEntityByIds(ids);
    }

    /**
     * 删除采购订单与供应商关联信息
     *
     * @param id 采购订单与供应商关联ID
     * @return 结果
     */
    @Override
    public int deleteOrderSupplierEntityById(String id)
    {
        return orderSupplierMapper.deleteOrderSupplierEntityById(id);
    }

}
